-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cluster: fail when no private address can be found #1437
Conversation
The memberlist library fails when it can't find a private address and no advertise address is given. To return a helpful message to the user, AlertManager mimics the logic from memberlist. However the code had a bug that swallowed the error message and made it difficult for the user to understand how to fix the problem. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get private IP") | ||
} | ||
if privateIP == "" { | ||
return nil, errors.Wrap(err, "no private IP found, explicit advertise addr not provided") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err
being nil, errors.Wrap(err, ...)
was also nil.
cluster/advertise.go
Outdated
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get private IP") | ||
} | ||
if privateIP == "" { | ||
return nil, errors.Wrap(err, "no private IP found, explicit advertise addr not provided") | ||
return nil, errors.Errorf("no private IP found, explicit advertise addr not provided") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use errors.New
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason. I'll update.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. In case there are no final thoughts by @stuartnelson3 I will merge tomorrow.
The memberlist library fails when it can't find a private address and no advertise address is given. To return a helpful message to the user, AlertManager mimics the logic from memberlist. However the code had a bug that swallowed the error message and made it difficult for the user to understand how to fix the problem. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Alertmanager fails to start when the memberlist library cannot find any private IP addresses on the system. This is a safeguard to avoid exposing cluster ports over the internet unintentionally. The workaround is to pass the --cluster.advertise-address argument to AlertManager. See also: prometheus/alertmanager#1437 prometheus/alertmanager#1434
Alertmanager fails to start when the memberlist library cannot find any private IP addresses on the system. This is a safeguard to avoid exposing cluster ports over the internet unintentionally. The workaround is to pass the --cluster.advertise-address argument to AlertManager. See also: prometheus/alertmanager#1437 prometheus/alertmanager#1434
Relates to #1434.